﻿var baseurlB = $("script").eq($("script").length - 1).attr("src"); //获取当前引用js的路径
var baseurl = typeof (baseurlB) == "undefined" ? "" : baseurlB.toLowerCase();
function _u(url) {return (window.CssDomain || "") + url;}


var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25310660-1']);
_gaq.push(['_trackPageview']);
var g_param = new Object();


//百度统计内容


jQuery(function() {

    if (jQuery(".photoserverval") != null)
        g_param.photoserver = jQuery(".photoserverval").val();
    $(".creatimg").hide();
    
});

function toFace(code) {
    return code.replace(/#(10\d|11[0-8]|12[2-5]|0[1-9]|[1-9]\d)/g, "<img src='http://img.duoyi.com/025/images/bq/%23$1.gif'/>");
}

jQuery(document).ready(function() {
    jQuery("input[type='radio']").css({ "margin-top": "-3px", "*margin-top": "0" });
});

jQuery.cookie = function(key, value, options) {

    // key and value given, set cookie...
    if (arguments.length > 1 && (value === null || typeof value !== "object")) {
        options = jQuery.extend({}, options);

        if (value === null) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? String(value) : encodeURIComponent(String(value)),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function(s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
//压缩之后的修改后的modal.js
; (function($) {
    var ie6 = $.browser.msie && parseInt($.browser.version) == 6 && typeof window['XMLHttpRequest'] != "object", ieQuirks = null, w = []; $.modal = function(data, options) { return $.modal.impl.init(data, options); }; $.modal.close = function(immediate) { $.modal.impl.close(immediate); }; $.fn.modal = function(options) { return $.modal.impl.init(this, options); }; $.modal.defaults = { appendTo: 'body', focus: false, opacity: 50, overlayId: 'simplemodal-overlay', overlayCss: {}, containerId: 'simplemodal-container', containerCss: {}, dataId: 'simplemodal-data', dataCss: {}, minHeight: null, minWidth: null, maxHeight: null, maxWidth: null, autoResize: false, autoPosition: true, zIndex: 8888, close: false, closeHTML: '<a class="modalCloseImg" title="Close"></a>', closeClass: 'simplemodal-close', escClose: false, overlayClose: false, position: null, persist: false, transient: false, onOpen: null, onShow: null, onClose: null }; $.modal.impl = { o: null, d: {}, init: function(data, options) { var s = this; if (s.d.data) { return false; } s.o = $.extend({}, $.modal.defaults, options); s.zIndex = s.o.zIndex; s.occb = false; if (typeof data == 'object') { data = data instanceof jQuery ? data : $(data); s.d.placeholder = false; if (data.parent().parent().size() > 0) { data.before($('<span></span>').attr('id', 'simplemodal-placeholder').css({ display: 'none' })); s.d.placeholder = true; s.display = data.css('display'); if (!s.o.persist) { s.d.orig = data.clone(true); } } } else if (typeof data == 'string' || typeof data == 'number') { data = $('<div></div>').html(data); } else { alert('SimpleModal Error: Unsupported data type: ' + typeof data); return s; } s.create(data); data = null; s.open(); if ($.isFunction(s.o.onShow)) { s.o.onShow.apply(s, [s.d]); } return s; }, create: function(data) { var s = this; w = s.getDimensions(); if (!s.o.transient && ie6) { s.d.iframe = $('<iframe src="javascript:false;"></iframe>').css($.extend(s.o.iframeCss, { display: 'none', opacity: 0, position: 'fixed', height: w[0], width: w[1], zIndex: s.o.zIndex, top: 0, left: 0 })).appendTo(s.o.appendTo); } s.d.overlay = $('<div></div>').attr('id', s.o.overlayId).addClass('simplemodal-overlay').css($.extend(s.o.overlayCss, { display: 'none', opacity: s.o.opacity / 100, height: s.o.transient ? 0 : w[0], width: s.o.transient ? 0 : w[1], position: 'fixed', left: 0, top: 0, zIndex: s.o.zIndex + 1 })).appendTo(s.o.appendTo); s.d.container = $('<div></div>').attr('id', s.o.containerId).addClass('simplemodal-container').css($.extend(s.o.containerCss, { display: 'none', position: 'fixed', zIndex: s.o.zIndex + 2 })).append(s.o.close && s.o.closeHTML ? $(s.o.closeHTML).addClass(s.o.closeClass) : '').appendTo(s.o.appendTo); s.d.wrap = $('<div></div>').attr('tabIndex', -1).addClass('simplemodal-wrap').css({ height: '100%', outline: 0, width: '100%' }).appendTo(s.d.container); s.d.data = data.attr('id', data.attr('id') || s.o.dataId).addClass('simplemodal-data').css($.extend(s.o.dataCss, { display: 'none' })).appendTo('body'); data = null; s.setContainerDimensions(); s.d.data.appendTo(s.d.wrap); if (ie6 || ieQuirks) { s.fixIE(); } }, bindEvents: function() { var s = this; $('.' + s.o.closeClass).bind('click.simplemodal', function(e) { e.preventDefault(); s.close(); }); if (!s.o.transient && s.o.close && s.o.overlayClose) { s.d.overlay.bind('click.simplemodal', function(e) { e.preventDefault(); s.close(); }); } $(document).bind('keydown.simplemodal', function(e) { if (!s.o.transient && s.o.focus && e.keyCode == 9) { s.watchTab(e); } else if ((s.o.close && s.o.escClose) && e.keyCode == 27) { e.preventDefault(); s.close(); } }); $(window).bind('resize.simplemodal', function() { w = s.getDimensions(); s.setContainerDimensions(true); if (ie6 || ieQuirks) { s.fixIE(); } else if (!s.o.transient) { s.d.iframe && s.d.iframe.css({ height: w[0], width: w[1] }); s.d.overlay.css({ height: w[0], width: w[1] }); } }); }, unbindEvents: function() { $('.' + this.o.closeClass).unbind('click.simplemodal'); $(document).unbind('keydown.simplemodal'); $(window).unbind('resize.simplemodal'); this.d.overlay.unbind('click.simplemodal'); }, fixIE: function() { var s = this, p = s.o.position; $.each([s.d.iframe || null, s.o.transient ? null : s.d.overlay, s.d.container], function(i, el) { if (el) { var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth', bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft', bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth', ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth', sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop', s = el[0].style; s.position = 'absolute'; if (i < 2) { s.removeExpression('height'); s.removeExpression('width'); s.setExpression('height', '' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"'); s.setExpression('width', '' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"'); } else { var te, le; if (p && p.constructor == Array) { var top = p[0] ? typeof p[0] == 'number' ? p[0].toString() : p[0].replace(/px/, '') : el.css('top').replace(/px/, ''); te = top.indexOf('%') == -1 ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"' : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; if (p[1]) { var left = typeof p[1] == 'number' ? p[1].toString() : p[1].replace(/px/, ''); le = left.indexOf('%') == -1 ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"' : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; } } else { te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; } s.removeExpression('top'); s.removeExpression('left'); s.setExpression('top', te); s.setExpression('left', le); } } }); }, focus: function(pos) { return; var s = this, p = pos || 'first'; var input = $(':input:enabled:visible:' + p, s.d.wrap); input.length > 0 ? input.focus() : s.d.wrap.focus(); }, getDimensions: function() { var el = $(window); var h = $.browser.opera && $.browser.version > '9.5' && $.fn.jquery <= '1.2.6' ? document.documentElement['clientHeight'] : $.browser.opera && $.browser.version < '9.5' && $.fn.jquery > '1.2.6' ? window.innerHeight : el.height(); return [h, el.width()]; }, getVal: function(v) { return v == 'auto' ? 0 : v.indexOf('%') > 0 ? v : parseInt(v.replace(/px/, '')); }, setContainerDimensions: function(resize) { var s = this; if (!resize || (resize && s.o.autoResize)) { var ch = $.browser.opera ? s.d.container.height() : s.getVal(s.d.container.css('height')), cw = $.browser.opera ? s.d.container.width() : s.getVal(s.d.container.css('width')), dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true); var mh = s.o.maxHeight && s.o.maxHeight < w[0] ? s.o.maxHeight : w[0], mw = s.o.maxWidth && s.o.maxWidth < w[1] ? s.o.maxWidth : w[1]; if (!ch) { if (!dh) { ch = s.o.minHeight; } else { if (dh > mh) { ch = mh; } else if (dh < s.o.minHeight) { ch = s.o.minHeight; } else { ch = dh; } } } else { ch = ch > mh ? mh : ch; } if (!cw) { if (!dw) { cw = s.o.minWidth; } else { if (dw > mw) { cw = mw; } else if (dw < s.o.minWidth) { cw = s.o.minWidth; } else { cw = dw; } } } else { cw = cw > mw ? mw : cw; } s.d.container.css({ height: ch, width: cw }); if (dh > ch || dw > cw) { s.d.wrap.css({ overflow: '' }); } } if (s.o.autoPosition) { s.setPosition(); } }, setPosition: function() { var s = this, top, left, hc = (w[0] / 2) - (s.d.container.outerHeight(true) / 2), vc = (w[1] / 2) - (s.d.container.outerWidth(true) / 2); if (s.o.position && Object.prototype.toString.call(s.o.position) === "[object Array]") { top = s.o.position[0] || hc; left = s.o.position[1] || vc; } else { top = hc; left = vc; } s.d.container.css({ left: left, top: top }); }, watchTab: function(e) { var s = this; if ($(e.target).parents('.simplemodal-container').length > 0) { s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]); if ((!e.shiftKey && e.target == s.inputs[s.inputs.length - 1]) || (e.shiftKey && e.target == s.inputs[0]) || s.inputs.length == 0) { e.preventDefault(); var pos = e.shiftKey ? 'last' : 'first'; setTimeout(function() { s.focus(pos); }, 10); } } else { e.preventDefault(); setTimeout(function() { s.focus(); }, 10); } }, open: function() { var s = this; s.d.iframe && s.d.iframe.show(); if ($.isFunction(s.o.onOpen)) { s.o.onOpen.apply(s, [s.d]); } else { s.d.overlay.show(); s.d.container.show(); s.d.data.show(); } s.focus(); s.bindEvents(); }, close: function(imme) { var s = this; if (!s.d.data) { return false } s.unbindEvents(); if (typeof (imme) != "undefined") { if (imme) s.occb = true } if ($.isFunction(s.o.onClose) && !s.occb) { s.occb = true; s.o.onClose.apply(s, [s.d]) } else { if (s.d.placeholder) { var ph = $('#simplemodal-placeholder'); if (s.o.persist) { ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display', s.display)) } else { if (typeof (imme) != "undefined") { if (imme) s.d.data.remove(); else s.d.data.fadeOut().remove() } else { s.d.data.hide().remove() } ph.replaceWith(s.d.orig) } } else { if (typeof (imme) != "undefined") { if (imme) s.d.data.remove(); else s.d.data.fadeOut() } else { s.d.data.hide().remove() } } s.d.container.remove(); if (typeof (imme) != "undefined") { if (imme) { s.d.overlay.remove(); s.d = {} } else { s.d.overlay.fadeOut(); setTimeout(function() { s.d.overlay.remove(); s.d = {} }, 200) } } else { s.d.overlay.hide().remove() } s.d.iframe && s.d.iframe.hide().remove(); if (typeof (imme) != "undefined") { } else { s.d = {} } } },
        hideX: function() {
            var s = this;
            if ($.isFunction(s.o.onHideX)) {
                // execute the onOpen callback
                s.o.onHideX.apply(s, [s.d]);
            } else {
                s.d.overlay.hide();
                s.d.container.hide();
                s.d.data.hide();
            }
        },
        openX: function() {
            var s = this;
            // display the iframe
            s.d.iframe && s.d.iframe.show();

            // display the remaining elements
            s.d.overlay.show();
            s.d.container.show();
            s.d.data.show();

            if ($.isFunction(s.o.onOpenX)) {
                // execute the onOpen callback 
                s.o.onOpenX.apply(s, [s.d]);
            }

            s.focus();

            // bind default events
            s.bindEvents();
        }
    };
    
    //缓存弹出层初始化函数和关闭函数
    var cache = {
        init : $.modal.impl.init , 
        close : $.modal.impl.close , 
        data : null , 
        options : null , 
        being : false
    };
    
    $.modal.impl.init = function(data, options){
        cache.data = data;
        cache.options = options;
        if(!cache.being){
            cache.being = true;
             //加载样式
             loadCss($.url("/css/module/popwin/popwin.css"), function(){
                $.modal.impl.init = cache.init;
                $.modal.impl.close = cache.close;
                cache.data && $.modal.impl.init(cache.data, cache.options);
                cache = null;
             })
        }
        return this;
    };
    
    $.modal.impl.close = function(){
        cache.data = null, cache.options = null;
    };
})(jQuery);



var pub = {
    getmax: function(a, b) {
        return a > b ? a : b;
    },
    isbetween: function(target, a, b) {
        if ((target > a && target < b) || (target < a && target > b))
            return true;
        return true;
    }
};

function G(oid) {
    return document.getElementById(oid);
}
function Close() {
    $.modal.close();
}
function ShowSpan(spanid) {
    $("#" + spanid).modal();
}
//得到url查询字符串对应键的值
function queryStr(arg) {
    var myreg = new RegExp("(&|^)" + arg + "=([^&]*)($|&)");
    var query = location.search.substr(1); if (query == null || query.length < 0) return '';
    var matchs = query.match(myreg);
    if (matchs == null)
        return "";
    return matchs[2];
}

function getUid() {
    var uid = queryStr("uid");
    if (uid != "")
        return uid;
    var lochref = location.href;

    var matches = lochref.match(/\/(\d+)\.html/);
    if (matches == null)
        return "";
    return matches[1];
}

function checkMaxlength(oevent, otarget) {

    var code = oevent.keyCode;
    if (code >= 33 || code == 13) {
        var maxlength = $(otarget).attr("maxlength");
        var length = otarget.value.length;
        if (length >= maxlength) {
            otarget.value = otarget.value.substr(0, maxlength);
            // oevent.preventDefault();
            return false;
        }
    }
}
//keyup事件
function upCheck(otarget, leftid) {
    var length = otarget.value.length;
    var maxlength = $(otarget).attr("maxlength");
    var leftnum = maxlength - length;
    if (leftnum < 0)
        leftnum = 0;
    $("#" + leftid).html(leftnum);
}

function replaceQuery(arg, dest)//只适应单个替换
{
    var myreg = new RegExp("&|^" + arg + "=([^&]*)$|&");
    var query = location.search.substr(1);
    if (query == null || query.length < 0) return;

    var ret = query.replace(myreg, arg + "=" + dest);
    return ret;
}

//依据年龄得到日期
function AgeDate(age) {
    var date = new Date();
    var year = date.getFullYear() - parseInt(age);
    date.setFullYear(year);
    return date;
}
//得到下拉框的选择元素
function GetSelect(selid) {
    var nodes = G(selid).options
    if (nodes.length < 1)
        return "";
    else {
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].selected)
                return nodes[i].text;
        }
    }
}
function setSelect(selid, seltext) {
    var options = G(selid).options;
    for (var i = 0; i < options.length; i++) {
        if (options[i].text == seltext) {
            options[i].selected = true;
        }
    }
}

//json 转换 到string
function obj2str(o) {
    var r = [];
    if (typeof o == "string" || o == null) {
        return o;
    }
    if (typeof o == "object") {
        if (!o.sort) {
            r[0] = "{"
            for (var i in o) {
                r[r.length] = i;
                r[r.length] = ":";
                r[r.length] = obj2str(o[i]);
                r[r.length] = ",";
            }
            r[r.length - 1] = "}"
        } else {
            r[0] = "["
            for (var ii = 0; ii < o.length; ii++) {
                r[r.length] = obj2str(o[ii]);
                r[r.length] = ",";
            }
            r[r.length - 1] = "]"
        }
        return r.join("");
    }
    return o.toString();
}

////////////StrBuiler对象////////////////
function StrBuilder() {
    this._array = [];
}
StrBuilder.prototype.append = function(str) {
    this._array.push(str.toString()); return this;
}
StrBuilder.prototype.toString = function(token) {
    if (token != null)
        return this._array.join(token);
    else
        return this._array.join("");
}
StrBuilder.prototype.clear = function() {
    this._array = [];
}

String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.trimLeft = function() {
    return this.replace(/(^\s*)/g, "");
}


Array.prototype.contains = function(obj) {
    var i = this.length;
    while (i--) {
        if (this[i] == obj)
            return true;
    }
    return false;
}

Array.prototype.delvalue = function(obj) {
    var i = this.length;
    while (i--) {
        if (obj == this[i]) {
            this.splice(i, 1);
            break;
        }
    }
}

///////////////cookie 读取与设置////////////////////
function setCookie(sname, svalue, expires, sdomain, bsecure) {
    var scookie = sname + "=" + encodeURIComponent(svalue);
    if (expires)
        scookie += "; expires=" + expires.toGMTString();

    scookie += "; path=/"
    if (sdomain)
        scookie += "; domain=" + sdomain;
    if (bsecure)
        scookie += "; secure";

    document.cookie = scookie;
}
//用户cookie为：uemail，upassword
function getCookie(sname) {
    var sre = "(?:;)?" + sname + "=([^;]*);?";
    var ore = new RegExp(sre);
    if (ore.test(document.cookie)) {
        return decodeURIComponent(RegExp["$1"]);
    }
    else
        return "";
}

function removeCookie(sname) {
    document.cookie = sname + "=;path=/;expires=" + (new Date(0).toLocaleDateString());
}

function copyToClipBoard(clipBoardContent) {

    if (window.clipboardData) {
        window.clipboardData.clearData();
        window.clipboardData.setData("Text", clipBoardContent);
    } else if (navigator.userAgent.indexOf("Opera") != -1) {
        window.location = clipBoardContent;
    } else if (window.netscape) {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        } catch (e) {
            alert("I'am Sorry! It's unsafe to do this!");
        }
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;
        trans.addDataFlavor('text/unicode');
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext = clipBoardContent;
        str.data = copytext;
        trans.setTransferData("text/unicode", str, copytext.length * 2);
        var clipid = Components.interfaces.nsIClipboard;
        if (!clip) return false;
        clip.setData(trans, null, clipid.kGlobalClipboard);
    }

    return true;
}


//暂不适用js动态替换风格
function setStyle() {
    var setstyle = getCookie("025style");
    if (setstyle == null)
        return;
    var cssstyle = $("#csscolor");
    if (cssstyle.size() > 0) //首页
    {
        if (cssstyle.attr("href").indexOf(setstyle) == -1)
            cssstyle.attr("href", "/css/" + setstyle + "/color.css");
    }
    var pagestyle = $("#csspagecolor");
    if (pagestyle.size() > 0) {
        if (pagestyle.attr("href").indexOf(setstyle) == -1)
            pagestyle.attr("href", "/css/" + setstyle + "/page_color.css");
    }

}

$.fn.extend({
    ToggleFocusCss: function(fclass, bclass) {
        this.foucs(function() { $(this).addClass(fclass).removeClass(bclass); });
        this.blur(function() { $(this).addClass(bclass).removeClass(fclass); });
    },
    ToggleFocusFun: function(focus, blur) {
        this.focus(focus);
        this.blur(blur);
    }
});


///region footer.js

var xmlHttp = null;
function createHttpRequest() {
    if (window.XMLHttpRequest)
        return new XMLHttpRequest();

    var msxml = ['Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];

    for (var i = 0; i < msxml.length; i++) {
        try {
            xmlHttp = new ActiveXObject(msxml[i]);
            break;
        }
        catch (ex) { }
    }
}

//报告我在线上，用于表示在线用户，可用户统计在线时间
//    function postMsg()
//    {
//        if(xmlHttp == null)
//            return;
//        xmlHttp.open("get","/handlers/mainhandler.ashx?type=2");
//        xmlHttp.send(null);
//    }

//endregion  footer.js

//region head.js
//共用头部JS

$(loadfun);
function loadfun() {

    if($("#sel_minage").size()==0)
        return;
    if (typeof jQuery == "undefined")
        return;
    var titles = ["025.com", "我的领爱", "会员搜索", "领爱生活","领爱电视", "领爱博客", "领爱学堂", "最新会员", "交友活动"];
    var title = document.title;
    var $subnav = $("#subnav li a,.topnav dl dd a").removeClass("current");
    var isfind = false;
    for (var i = 0; i < titles.length; i++) {
        if (title.indexOf(titles[i]) > -1) {
            $subnav.eq(i).addClass("current");
            isfind = true;
            break;
        }
    }
    if (!isfind) {
        $subnav.eq(0).addClass("current");
    }

}

function my025() {
    var href = location.href.indexOf("index.aspx");

    if ($(".cs_for_query").css("display") == "none" || $("#login1_div_loged").css("display") == "none") {
        if (href == -1)
            lwy.tipLogin();
        else {
            showAlert("对不起，您需要先在右侧登录哦!");
            $("#txt_name").focus();
        }
    }
    else if ($(".l-login-input").size() > 0) {
        if (href == -1)
            lwy.tipLogin();
        else {
            showAlert("对不起，您需要先在右侧登录哦!");
            $("#txt_name").focus();
        }
    } else
        location.href = "/pages/space/personal.aspx";
}

function phoneLove() {
    if ($(".cs_for_query").css("display") == "none" || $("#login1_div_loged").css("display") == "none")
        window.open("/pages/mobilemsg.aspx");
    else
        location.href = "/pages/mobilemsg.aspx";
}



///////////////////////顶部搜索条搜索条
$(function() {

     if($("#sel_minage").size()==0)
        return;
    if ($(".search").length > 0) {
        $('.prov_class').change(provChange);
        setSearchContent();
        setSeach2();
    }
});

function setSeach2() {
    var buidQu = getCookie("buidQuery");
    if ($(".search").length == 0) {
        return;
    }
    if (buidQu == "") {
        $.post("/handlers/seahandler.ashx?type=ud_search", {}, function(data) {
            var msg = eval(data);
            if (typeof (msg) != 'undefined') {
                if (msg[0] == "男") {
                    $("#sel_sex").val("0"); //性别
                } else {
                    $("#sel_sex").val("1");
                }
                if (msg[1] == "不限") {
                    $("#check_photo").attr("checked", "checked"); //照片
                }
                $(".prov_class").val(msg[2]); //省份
                $(".prov_class").trigger("change"); //*****************************************************************响应身份联动，可以得到城市
                setTimeout(function() {
                    setSelect("sel_city", msg[3]);
                }, 600);
                //provChange()
                setTimeout(function() {
                    $("#sel_minage").val(msg[4]); //最小年龄
                    $("#sel_maxage").val(msg[5]); //最大年龄
                }, 200);
                setTimeout(function() {
                    $("#sel_minheight").val(msg[6]); //最小身高
                    $("#sel_maxheight").val(msg[7]); //最大身高
                }, 200);
            }
        });
    }
}

function minage_change() {
    //    var minage = $("#sel_minage").val();
    //    if (minage >= 91)
    //        $("#sel_maxage").val("99");
    //    else
    //        $("#sel_maxage").val(parseInt(minage) + 8);
}

function minheight_change() {
    //    var minheight = $("#sel_minheight").val();
    //    if (minheight == "不限")
    //        $("#sel_maxheight").val("不限");
    //    if (minheight >= 220)
    //        $("#sel_maxheight").val("260");
    //    else
    //        $("#sel_maxheight").val(parseInt(minheight) + 10);
}

function setSearchContent() {
    
    var seasex = getCookie("025sex");
    if (seasex != "")
        $("#sel_sex").val(seasex);
    //添加年龄和高度的数据
    var maxage = 99, minage = 18, maxheight = 260, minheight = 130;
    var ofrag = document.createDocumentFragment();
    for (var i = minage; i <= maxage; i++) {
        var tmp = document.createElement("option");
        tmp.innerHTML = i.toString();
        ofrag.appendChild(tmp);
    }
    $("#sel_minage").html("");
    G("sel_minage").appendChild(ofrag);
    $("#sel_maxage").html("");
    $("#sel_maxage").append(G("sel_minage").innerHTML);
    setTimeout(relaySetAge, 100);

    ofrag = document.createDocumentFragment();
    for (var i = minheight; i <= maxheight; i++) {
        var tmp = document.createElement("option");
        tmp.innerHTML = i.toString();
        ofrag.appendChild(tmp);
    }
    $("#sel_minheight").append(ofrag);
    $("#sel_maxheight").html("");
    $("#sel_maxheight").append($("#sel_minheight").html());
    setTimeout(relaySetHeight, 100);

    //以下为处理保存搜索项,包括性别和有无照片、身份与城市
    var buidQu = getCookie("buidQuery");
    //provChange()
    if (buidQu != "") {
        var buid = buidQu.split('>'); 
        $("#sel_sex").attr("value", buid[0]); //性别
        $(".prov_class").attr("value", buid[1]); //省
        setTimeout(function() {
            setSelect("sel_city", buid[2]); //市
            $("#btn_sea").css("display", "");
            $("#btn_sea_span").css("visibility", "visible");
        }, 1000);
        provChange()
        var ch = buid[15];
        if (ch == "1") {
            $("#check_photo").attr("checked", "checked");
        } else {
            $("#check_photo").attr("checked", "");
        }
        relaySetHeadOther(buidQu);
    }
}
// 0      1     2       3         4         5         6       7      8       9     10    11    12    13    14    15      16   
//性别，省份，城市，最小年龄，最大年龄，最小高度，最大高度，婚姻，所在行业，星级，以上，薪水，以上，学历，以上，照片，头部标识
function relaySetHeadOther(buidQu) {
    var buid = buidQu.split('>');
    $("#h_marry").val(buid[7]);
    $("#h_field").val(buid[8]);
    $("#h_star").val(buid[9]);
    if (buid[10] == "0")
        $("#hu_star").attr("checked", "");
    else
        $("#hu_star").attr("checked", "checked");
    $("#h_salary").val(buid[11]);
    if (buid[12] == "0")
        $("#hu_salary").attr("checked", "");
    else
        $("#hu_salary").attr("checked", "checked");
    $("#h_edu").val(buid[13]);
    if (buid[14] == "0")
        $("#hu_edu").attr("checked", "");
    else
        $("#hu_edu").attr("checked", "checked");
}

//设置默认搜索年龄和保存搜索年龄
function relaySetAge() {
    var buidQu = getCookie("buidQuery");
    if (buidQu != "") {
        var buid = buidQu.split('>');
        setSelect("sel_minage", buid[3]);
        setSelect("sel_maxage", buid[4]);
    } else {
        setSelect("sel_minage", "22");
        setSelect("sel_maxage", "30");
    }
}

//设置默认搜索高度和保存搜索高度
function relaySetHeight() {
    var buidQu = getCookie("buidQuery");
    if (buidQu != "") {
        var buid = buidQu.split('>');
        setSelect("sel_minheight", buid[5]);
        setSelect("sel_maxheight", buid[6]);
    }
}

//省份选择改动
function provChange() {
    var opts = $('.prov_class')[0].options;
    var len = opts.length;
    for (var i = 0; i < len; i++) {
        if (opts[i].selected) {
            if (opts[i].value != "0") {
                $.get("/handlers/fraghandler.ashx?type=city", "prov=" + opts[i].value, function(res) { procRes(res, "sel_city"); });
            }
            else {
                $("#sel_city").html("");
                $("#sel_city").append("<option value=''>不限</option>");
            }
            return;
        }
    }
}

function sea_click0() {
    var strwhere = buildQuery0();
    setCookie("buidQuery", strwhere);  //保存搜索条件
    $.post("/handlers/seahandler.ashx?type=encrypt", "strwhere=" + strwhere, function(data) {

        location.href = "/pages/search/Res_word.aspx?str=" + encodeURI(data);

    });
}
//性别，省份，城市，最小年龄，最大年龄，最小高度，最大高度，婚姻，所在行业，星级，以上，薪水，以上，学历，以上，照片，头部标识
function buildQuery0() {
    var queryArray = new Array();
    queryArray.length = 17;
    //性别
    queryArray[0] = $('#sel_sex').val();
    //省市
    queryArray[1] = $(".prov_class").val();
    queryArray[2] = GetSelect("sel_city");
    //年龄
    if (parseInt($("#sel_minage").val()) > parseInt($("#sel_maxage").val())) {
        queryArray[3] = $("#sel_maxage").val();
        queryArray[4] = $("#sel_minage").val();
    } else {
        queryArray[3] = $("#sel_minage").val();
        queryArray[4] = $("#sel_maxage").val();
    }
    //身高
    if (parseInt($("#sel_minheight").val()) > parseInt($("#sel_maxheight").val())) {
        queryArray[5] = $("#sel_maxheight").val();
        queryArray[6] = $("#sel_minheight").val();
    } else {
        queryArray[5] = $("#sel_minheight").val();
        queryArray[6] = $("#sel_maxheight").val();
    }
    //婚姻
    queryArray[7] = $("#h_marry").val();
    //行业
    queryArray[8] = $("#h_field").val();
    //星级以上
    queryArray[9] = $("#h_star").val();
    var hu_star = 0;
    if ($("#hu_star").attr("checked"))
        hu_star = 1;
    queryArray[10] = hu_star;
    //薪水以上
    queryArray[11] = $("#h_salary").val();
    var hu_salary = 0;
    if ($("#hu_salary").attr("checked"))
        hu_salary = 1;
    queryArray[12] = hu_salary;
    //学历以上
    queryArray[13] = $("#h_edu").val();
    var hu_edu = 0;
    if ($("#hu_edu").attr("checked"))
        hu_edu = 1;
    queryArray[14] = hu_edu;
    //照片
    if ($("#check_photo").attr("checked")) {
        queryArray[15] = 1;
    }
    else {
        queryArray[15] = 0;
    }
    //头部标志
    queryArray[16] = "headSearch";
    return queryArray.join(">");
}




//响应用户省份选择联动   
function procRes(data, selid) {
    if (data.length < 2)
        return;
    data = eval(data);
    var ofrag = document.createDocumentFragment();

    var first = document.createElement("option");
    first.value = "";
    first.innerHTML = "不限";
    ofrag.appendChild(first);

    for (var i = 0; i < data.length; i++) {
        var opt = document.createElement("option");
        opt.value = data[i].code;
        opt.innerHTML = data[i].city;
        ofrag.appendChild(opt);
    }
    G(selid).innerHTML = "";
    G(selid).appendChild(ofrag);

}

function save_collect() {
    var sps = document.URL.split('/');
    var domainname = "http://" + sps[2] + "/";
    var description = "领爱网--门当户对的婚恋交友网站";
    try {
        window.external.AddFavorite(domainname, description);
    }
    catch (e) {
        window.sidebar.addPanel(description, domainname, "");
    }
}

//设为首页
function set_main(obj) {
    var sps = document.URL.split('/');
    var domainname = "http://" + sps[2] + "/";
    try {
        obj.style.behavior = "url(#default#homepage)";
        obj.setHomePage(domainname);
    }
    catch (e) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert("It's not safy to do this！");
            }
            var prefs = Components.classes["'@mozilla.org/preferences-service;1'"].getService(Components.inerfaces.nslPrefBranch);
            prefs.setCharPref('browser.startup.homepage', domainname);
        }
    }
}

////////////////////换肤相关代码/////////////////////////////
function set_pink() {

    var current = getCookie("025style");
    if (current == "pink")
        return;
    var expiredate = new Date();
    expiredate.setTime(expiredate.getTime() + 360 * 24 * 3600 * 1000);
    setCookie("025style", "pink", expiredate);
    //$(".avi1").css("background","url(http://img.duoyi.com/025/images/new/h_03.gif)");
    location.reload();
}

function set_blue() {
    var current = getCookie("025style");
    if (current == "blue")
        return;
    var expiredate = new Date();
    expiredate.setTime(expiredate.getTime() + 360 * 24 * 3600 * 1000);
    setCookie("025style", "blue", expiredate);
    //$(".avi1").css("background","url(http://img.duoyi.com/025/images/new/h_04.gif)");
    location.reload();
}

$(function() {
    var current = getCookie("025style");
    if (current == "blue")
        $("#p_style").addClass("avi2");
    else
        $("#p_style").addClass("avi1");
});
//传入省份的编号，返回省份的名字
function GetProvinceName(provinceCode) {
    var aid = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34";
    var aname = "不限,广东,北京,福建,甘肃,辽宁,广西,贵州,海南,河北,河南,黑龙江,湖北,湖南,吉林,江苏,江西,安徽,内蒙古,宁夏,青海,山东,山西,陕西,四川,西藏,新疆,云南,浙江,台湾,香港,澳门,上海,天津,重庆";

    var name = aname.split(",");

    return name[provinceCode];
}

//endregion
//省份 
function OnloadProvince(ddlprovince) {
    //获取省份下拉菜单
    //获取服务器输出的字符串并拆分成数组（省份列表）
    var aid = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34";
    var aname = "-不限-,广东,北京,福建,甘肃,辽宁,广西,贵州,海南,河北,河南,黑龙江,湖北,湖南,吉林,江苏,江西,安徽,内蒙古,宁夏,青海,山东,山西,陕西,四川,西藏,新疆,云南,浙江,台湾,香港,澳门,上海,天津,重庆";
    var provincelist = aname.split(",");
    var provincelist2 = aid.split(",");
    //先将下拉菜单全部清空：
    var dprovince = document.getElementById(ddlprovince);
    while (dprovince.options.length > 0) {
        $(dprovince).html("");
    }
    var ofrag = document.createDocumentFragment();
    for (var i = 0; i < provincelist.length; i++) {
        var opt = document.createElement("option");
        opt.innerHTML = provincelist[i];
        opt.value = provincelist2[i];
        ofrag.appendChild(opt);
    }
    document.getElementById(ddlprovince).appendChild(ofrag);
}
//省份城市的下拉菜单01
function changeprovince(ddlprovince, ddlCity) {
    var ddlpvovinceid = document.getElementById(ddlprovince).value;
    if (ddlpvovinceid != "0") {
        $.get("/Handlers/Action.ashx?action=selectcity&provincecode=" + ddlpvovinceid + "&rand=" + new Date().getTime(), function(date) {
            //获取城市下拉菜单
            var selcity = document.getElementById(ddlCity);
            //获取服务器输出的字符串并拆分成数组（城市列表）
            var citylist = date.split(",");
            //先将下拉菜单全部清空：
            while (selcity.options.length > 0) {
                $(selcity).html("");
            }
            var ofrag = document.createDocumentFragment();
            var ot = document.createElement("option");
                ot.innerHTML = "不限";
                ot.value = "不限";
                ofrag.appendChild(ot);
            for (var i = 0; i < citylist.length; i++) {
                //动态添加下拉菜单的选项
                var opt = document.createElement("option");
                opt.innerHTML = citylist[i];
                opt.value = citylist[i];
                ofrag.appendChild(opt);
            }
            document.getElementById(ddlCity).appendChild(ofrag);
        });
    }
    else {
        var selcity = document.getElementById(ddlCity);
        var dd = "-不限-"
        var citylist = dd.split(",");
        while (selcity.options.length > 0) {
            $(selcity).html("");
        }
        var ofrag = document.createDocumentFragment();
        for (var i = 0; i < citylist.length; i++) {
            var opt = document.createElement("option");
            opt.innerHTML = citylist[i];
            opt.value = citylist[i];
            ofrag.appendChild(opt);
        }
        document.getElementById(ddlCity).appendChild(ofrag);
    }
}

//省份城市的下拉菜单02
function changeprovince2(ddlprovince, ddlCity) {
    var ddlpvovinceid = document.getElementById(ddlprovince).value;
    if (ddlpvovinceid != "0") {
        $.get("/Handlers/Action.ashx?action=selectcity&provincecode=" + ddlpvovinceid + "&rand=" + new Date().getTime(), function(date) {
            //获取城市下拉菜单
            var selcity = document.getElementById(ddlCity);
            //获取服务器输出的字符串并拆分成数组（城市列表）
            var cy = "不限," + date;
            var citylist = cy.split(",");
            //先将下拉菜单全部清空：
            while (selcity.options.length > 0) {
                $(selcity).html("");
            }
            var ofrag = document.createDocumentFragment();
            for (var i = 0; i < citylist.length; i++) {
                //动态添加下拉菜单的选项
                var opt = document.createElement("option");
                opt.innerHTML = citylist[i];
                opt.value = citylist[i];
                ofrag.appendChild(opt);
            }
            document.getElementById(ddlCity).appendChild(ofrag);
        });
    }
    else {
        var selcity = document.getElementById(ddlCity);
        var dd = "请选择"
        var citylist = dd.split(",");
        while (selcity.options.length > 0) {
            $(selcity).html("");
        }
        var ofrag = document.createDocumentFragment();
        for (var i = 0; i < citylist.length; i++) {
            var opt = document.createElement("option");
            opt.innerHTML = citylist[i];
            opt.value = citylist[i];
            ofrag.appendChild(opt);
        }
        document.getElementById(ddlCity).appendChild(ofrag);
    }
}


function addFriend(oneid) {
    var param = $.param({ "class": 1, "cancel": "false", "fid": oneid });
    $.get("/handlers/spacehandler.ashx?type=savecontact", param, function(data) {
        if (data == "1") {
            showTip("添加关注成功！");
            //新版个人空间页面
            if ($("#xAddFriend").length >= 0 || $("#xAddFriend1").length >= 0) {
                $("#xAddFriend .s_btn_att").text("已关注");
            }
            //新版收件箱
            if ($("#isFriend").length >= 0) {
                $("#isFriend").attr("class", "sms_notatt");
            }

            var str = "addFriend(" + oneid + ")";
            var strother = "addAtte(" + oneid + ",1)";
            if ($("[href$='" + strother + "']").size() > 0) {
                $("[href$='" + strother + "']").html("已经关注");
                $("[href$='" + strother + "']").attr("href", "javascript:void(0)");
            }
            $("[href$='" + str + "']").attr("title", "已经关注");
            $("[href$='" + str + "']").attr("class", "atted");
            $("[href$='" + str + "']").attr("href", "javascript:void(0)");
        }
        else if (data.length < 100) {
            data = eval(data);
            if (data[0].code == 10000)
                lwy.tipLogin();
            else
                showAlert(data[0].msg);
        }
        else
            showAlert("操作失败，请联系管理员");
    });
}
function addAtte(oneid, ishomepage) {
    var param = $.param({ "class": 1, "cancel": "false", "fid": oneid });
    $.get("/handlers/spacehandler.ashx?type=savecontact", param, function(data) {
        if (data == "1") {
            showTip("添加关注成功！");
            var str = "addAtte(" + oneid + "," + ishomepage + ")";
            var strother = "addFriend(" + oneid + ")";
            if ($("[href$='" + strother + "']").size() > 0) {
                $("[href$='" + strother + "']").attr("title", "已经关注");
                $("[href$='" + strother + "']").attr("class", "atted");
                $("[href$='" + strother + "']").attr("href", "javascript:void(0)");
            }
            $("[href$='" + str + "']").html("已经关注");
            $("[href$='" + str + "']").attr("href", "javascript:void(0)");
        }
        else if (data.length < 100) {
            data = eval(data);
            if (data[0].code == 10000)
                lwy.tipLogin();
            else
                showAlert(data[0].msg);
        }
        else
            showAlert("操作失败，请联系管理员");
    });
}

$(document).ready(function() {

    $(".footer>a").each(function() {
        if ($(this).text() == "百度统计") {
            $(this).hide();
            return false;
        }
    });

    var num1 = 0;
    $(".xjmouse").hover(function() {
        if (num1 == 0) {
            $(this).find(".xjinfor").animate({ top: "-30px", opacity: "show" }, function() { num1 = 1; });
        }
    }, function() {
        if (num1 == 1) {
            $(this).find(".xjinfor").animate({ top: "-35px", opacity: "hide" }, function() { num1 = 0; });
        }
    });
});

//-----------------------------------出生日期-----------------------------------------------
function OnLoadBirth(birth) {
    var date = new Date();
    //先将下拉菜单全部清空：
    var birthoption = document.getElementById(birth);
    while (birthoption.options.length > 0) {
        $(birthoption).html("");
    }
    var ofrag = document.createDocumentFragment();
    var opt = document.createElement("option");
    opt.innerHTML = "请选择";
    opt.value = 0;
    ofrag.appendChild(opt);
    var minyear = date.getFullYear() - 99;
    var maxyear = date.getFullYear() - 18;
    for (var i = maxyear; i >= minyear; i--) {
        opt = document.createElement("option");
        opt.innerHTML = i;
        opt.value = i;
        ofrag.appendChild(opt);
    }
    document.getElementById(birth).appendChild(ofrag);
}


//region 统一的手机验证快内容
function GetTelCode() {
    var phone = G("tet_tel").value;
    var reg = /^1\d{10}$/;
    if (!reg.test(phone)) {
        showTip("请输入正确手机号码");
        return;
    }
    $.post("/handlers/credithandler.ashx?type=getcode", "phone=" + phone, function(data) {
        if (data != "1") {
            showTip("网络忙，请稍后再试！");
        }
        else
            showTip("验证码已发送，请注意查收！");
    });
    G("btngetcode").disabled = true;

    setTimeout(ResetUi, 18000);
}

//手机验证
function CheckTelCode() {
    var code = G("tettelcode").value;
    var reg = /^\d{4,}$/;
    if (!reg.test(code)) {
        showTip("请输入正确的验证码!");
        return;
    }
    $.post("/handlers/credithandler.ashx?type=checkcode", "code=" + code, function(data) {
        if (data == "1") {
            showTip("手机验证成功！");
            $.modal.close();
        }
        else if (data == "0") {
            location.href = "/login.aspx";
        }
        else if (data.length < 100) {
            showTip(data);
        }
    });
}

function ResetUi() {
    G("btngetcode").disabled = false;
}

function ShowTelMessage() {
    if ($("#divchecktel").size() > 0) {
        $("#divchecktel").modal();
        return;
    }
    $("form").append("<div class='pop6' style='width:468px;display:none' id='divchecktel'>\
        	        <div class='pop_' style='position:relative;'>\
             	    <p class='pp_title2' style='border-bottom:1px solid #eee;'><a href='#' onclick='$.modal.close()' class='close fr' title='关闭'><span>关闭</span></a><strong class='fb'>绑定手机号<span class='font_blue'>（该操作需要绑定手机号后进行）</span></strong></p>\
                    <div class='suggest'>\
		            <p><strong class='font14'>手机号码：</strong><input maxlength='11' type='text' name='textfield' id='tet_tel' /> <input onclick='GetTelCode()' name='' type='button' value='发送验证码' class='button9' id='btngetcode' /></p>\
		            <p><strong class='font14'>验 证 码：</strong><input type='text' name='textfield' id='tettelcode' /></p>\
                    <p class='fontct fred'><input name='' type='button' value='确定' class='button1' onclick='CheckTelCode()'/>  <input name='' type='button' value='取消' class='button1' onclick='Close()'/></p>\
                    <p style='border:1px solid #ccc; padding:10px;'>\
                    <strong>为什么要绑定您的手机呢？</strong><br />\
                    * 不受限制，发布内心独白，博客、状态、评论等操作<Br />\
                    * 绑定手机后，免费接收异性给您发送的手机短信<Br />\
                    * 彰显您的诚信度，并可获赠20礼金<br>\
                    <span style='color:red'>* 绑定手机无需收取任何费用，绝不将您的联系方式提供给第三方</span>\
                    </p>\
                    </div>\
                    </div>\
                    </div>");
    $("#divchecktel").modal();
}
//endregion


$("document").ready(function() {
    $(".a_status").click(function() {
        //$(this).addClass("a_status_on");
        $(".statuslist").slideDown("fast");
        return false;
    });
    $("body").click(function() {
        $(".statuslist").slideUp("fast", function() {
            //$(".a_status").removeClass("a_status_on");
        });
    });
});

$(function() {
    $(".rzname").attr("title", "专属昵称");
});

//显示简单的用户弹出,所有地方公用
function showDetail(oneid) {
    if (typeof dytjlite != 'undefined')
        dytjlite("showDetail-" + oneid);
		
	if(!showDetail.waqq){
		if($("#__waqqCss").length==0){
			$.ajax({type : "get",url :"/js/package/dig.js",cache : true,dataType : "script"})
		};
		
		showDetail.waqq = true;
	};

	window.open("/user/" + oneid + ".html");
	return;
    //添加等待loading图片
    $.get("/handlers/seahandler.ashx?type=loadpop", "uid=" + oneid, function(data) {
        if (data == null || data == "") {
            lwy.tipLogin();
        } else {
            $.modal(data);
        }
    })
}

var lwy = {};

lwy.addLoading = function(parentId) {
    $("#" + parentId).html("<center><img src=\"http://img.duoyi.com/025/images/loading.gif\" /></center>");
}
lwy.addModalLoading=function()
{
    $("<div><center><img src=\"http://img.duoyi.com/025/images/loading.gif\" /></center><div>").modal();
}
lwy.tipLogin = function() {
    if (typeof (PopLogin) == "function") {
        var pop = new PopLogin();
        pop.show();
    }
    else {
        $.getScript(_u("/js/common/poplogin.js"));
    }
}

function tmpshow()
{
     reglogin.show(); 
}

//2012-5-15,用于公共弹出简洁层

//$.tipModal({"desc":"注册邮箱验证后方可操作","tipId":"div_tip_formail"});

$.extend({tipModal:function(sets){
    var sets = $.fn.extend({"tipId":"pop_modal_id",
                            "title":"温馨提示",
                            "ok_words":"确认",
                            "topic":"",
                            "desc":"",
                            "confirmFun":function(){$.modal.close();},
                            "closeFun":function(){$.modal.close();}
    },sets);
    
    var jqsec = "#"+sets.tipId;
    if($(jqsec).size()>0)
    {
        $(jqsec).modal();
        return;
    }    
   
   var conHtml =  "<div id='"+sets.tipId+"' class='ui_popwin' style='display:none'>\
                      <div class='ui_popwin_box'>\
                        <div class='ui_popwin_title fb f14px'>"+sets.title+"<a title='关闭' class='ui_pop_close fn_right'>关闭</a></div>\
                        <div class='ui_popwin_con'>\
                          <p class='tc fb f14px fgray'>"+sets.topic+"</p>\
                          <p class='tc fgray'>"+sets.desc+"</p>\
                          <div class='ui_btn_pos'>\
                            <input type='button' class='ui_button' value='"+sets.ok_words+"'/>\
                          </div>\
                        </div>\
                      </div>\
                    </div>";
     
     
        var node = document.createElement("link");
        node.setAttribute("rel","stylesheet");
        node.setAttribute("type","text/css");
        node.setAttribute("href","/css/module/popwin/popwin.css");
        document.body.appendChild(node);
        styleOnload(node,function(){
            $(conHtml).modal();
            setTimeout(function(){
                $(jqsec).find("a.ui_pop_close").click(function(){sets.closeFun.call();});
                $(jqsec).find("input.ui_button").click(function(){sets.confirmFun.call();});
            },1000);
        });

}});


//region 判断css 加载完成
function styleOnload(node, callback) {

    if (node.attachEvent) {node.attachEvent('onload', callback);}

    else {
        setTimeout(function() {poll(node, callback);}, 0); // for cache
        }
}

function poll(node, callback) {
    if (callback.isCalled) {return;}

    var isLoaded = false;

    if (/webkit/i.test(navigator.userAgent)) {//webkit
        if (node['sheet']) 
            isLoaded = true;
       
    }
    // for Firefox
    else if (node['sheet']) {
        try {
            if (node['sheet'].cssRules)
                isLoaded = true;
        
        } catch (ex) {
       
            if (ex.code === 1000) 
                isLoaded = true;
        }
    }

    if (isLoaded) {
    // give time to render.
    setTimeout(function() {
    callback();
    }, 1);
    }
    else {
    setTimeout(function() {
    poll(node, callback);
    }, 1);
    }
}

//endregion

//恋爱学堂和情感博客的回复
function reverback(name, id) {
    $.post("/handlers/userindiv.ashx?action=rever&backid=" + id, {}, function(data) {
        if (data != "OK") {
            showAlert(data);
            return;
        } else {
            $(".therever").css("display", "");
            $(".hidrever").text("回复：<a href='/user/" + id + ".html'>" + name + "</a><br />");
            $(".rever").text("回复：" + name);
            $("*[hh=content]").focus();
        }
    });
}

function tipMe() {
    showAlert('请不要回复自己的评论!');
}

//评论添加图片
function commentAddImg(imgCode, place) {//imgCode:图片编号  place:如果有重复的属性的文本框，根据其ID下的某个
    var content = null;
    if ($("#tetcontent").length > 0) {
        content = $("#tetcontent").val();
        $("#tetcontent").val(content + imgCode).focus();
    } else if ($("*[wrap=physical]").length > 0) {
        content = $("#" + place + " *[wrap=physical]").val();
        $("#" + place + " *[wrap=physical]").val(content + imgCode).focus();
    }
}
//创建图片弹出层
function creatCommentImg(name, width, left, bottom, place) {//name:在某个编号之前创建弹出层  width:弹出层的宽度  left:距离左边的  bottom:距离右边 place:给img的单机事件用的，确定是往具体的哪个文本框输值
    var hh = $(".hh");
    if (hh.length <= 0) {
        var msg = "";
        for (var i = 1; i <= 45; i++) {
            msg += "<a href='javascript:void(0)' onclick=commentAddImg('#" + i + "','" + place + "') onmouseover='onmouseimg(" + i + ")' onmouseout='onout()'><img src='http://img.duoyi.com/025/images/commentImg/" + i + ".gif' style='width:30px;height:30px'/></a>"
            if (i % 9 == 0) {
                msg += "<br />";
            }
        }
        $(".hh").remove();
        if ($("*[wrap=physical]").length > 0) {//证明是在动态里面的
            name = "#" + place + " " + name;
        }
        $(name).before("<div style='border:solid 1px red; width:" + width + "px; margin-left:" + left + "px;position:absolute;bottom:" + bottom + "px; background-color:white' class='hh'>\
        <a class='close' href='javascript:void(0)' onclick='cloImg()'></a><br />\
        <div style='width:60px;height:60px;float:right;' id='bigimg'></div>\
        <div>" + msg + "</div>\
        </div>");
        if ($("*[wrap=physical]").length > 0)
            $(name).text("关闭表情");
        else
            $(".creatimg").text("关闭表情");
    } else {
        hh.remove();
        if ($("*[wrap=physical]").length > 0)
            $(name).text("插入表情");
        else
            $(".creatimg").text("插入表情");
    }
}

function onmouseimg(num) {
    $("#bigimg").append("<img src='http://img.duoyi.com/025/images/commentImg/" + num + ".gif' style='width:58px;height:58px;'>");
}
function onout() {
    $("#bigimg").html("<div style='width:60px;height:60px;float:right;margin-top:8px;' id='bigimg'></div>");
}
function cloImg() {
    $(".hh").remove();
    $(".creatimg").text("插入表情");
}
//举报
$.extend({
    //bereportuserid 被举报用户id
    //bereportusernick 被举报用户昵称
    //bereportid 举报内容的id
    //bereporttitle 举报内容的标题
    //bereporttype 举报内容的类型
    report: function(bereportuserid, bereportusernick, bereportid, bereporttitle, bereporttype) {
        var options = { uid: bereportuserid, nick: bereportusernick, topicid: bereportid, topictitle: bereporttitle, topictype: bereporttype };
        if (typeof (reporttopic) == "undefined") {
            $.getScript(_u("/js/report.js"), function() {
                reporttopic(options);
            });
        }
        else
            reporttopic(options);
    }
});

//使用方法：新建一个ul（用来显示下拉），再建一个hadden:三个参数必须：（id必须为email_keyup | value:邮箱账号的ID | hh:显示下拉ul的id | tt:输入密码框的id）即可实现登录邮箱提示
if ($("#email_keyup").length > 0) {
    var oInput = document.getElementById($("#email_keyup").val());
    oInput.options = document.getElementById($("#email_keyup").attr("hh")).getElementsByTagName("li");
    oInput.seletedIndex = -1;
    var mynum = 0;
    //记住前一次输入框的值，该两个值主要是用于兼容某些用户习惯于用输入中文按回车来输入英文，但回车会被执行确认而输入第一个邮箱而设定的
    var writes = "";
    //现在这个输入框的值
    var writing = "";

    oInput.onkeyup = function(event) {
        ClewEmail($("#email_keyup").attr("hh"), $("#email_keyup").val());
        if (event == undefined) {
            event = window.event;
        }

        switch (event.keyCode) {
            case upKeyCode:
                mynum = 0;
                clearSelectedOptBgColor(this);
                this.seletedIndex--;
                if (this.seletedIndex < 0)
                    this.seletedIndex = this.options.length - 1;
                setSelectedOptBgColor(this);
                break;

            case downKeyCode:
                mynum = 0;
                clearSelectedOptBgColor(this);
                this.seletedIndex++;
                if (this.seletedIndex >= this.options.length)
                    this.seletedIndex = 0;
                setSelectedOptBgColor(this);
                break;

            case enterKeyCode:
                var value = $("#" + $("#email_keyup").val()).val();
                if (mynum > 0 || writes.length > 0) {
                    mynum = 0;
                    $("#" + $("#email_keyup").attr("hh")).css("display", "none");
                    $("#" + $("#email_keyup").attr("tt")).focus();
                }
                if (writes == "" && value.length > 1 && mynum == 0) {
                    mynum++;
                }
                $("#" + $("#email_keyup").val()).val($("#ClewEmail li").eq(this.seletedIndex).html());
                var pass = $("#email_keyup").attr("tt");
                $("#" + pass + "").focus();
                break;
            default: mynum = 0; break;
        }
        writes = $("#" + $("#email_keyup").val()).val();
        if (event.keyCode != 38 && event.keyCode != 40) {
            this.seletedIndex = 0;
            setSelectedOptBgColor(this);
        }

    };

    function closeClewEmail() {
        $("#ClewEmail").css("display", "none");
    }
    var backId = "";
    $(function() {
        var tempKeyUp = $("#email_keyup").val();

        $("#" + tempKeyUp + "").keydown(function(e) {
            $("#ClewEmail li").each(function() {
                if ($(this).css("background-color") == "rgb(232, 244, 252)" || $(this).css("background-color") == "#e8f4fc") {
                    backId = $(this).text();
                }
            });
        });

        var ePassId = $("#email_keyup").attr("tt");
        var eUserId = $("#email_keyup").val();
        $("#" + ePassId + "").focus(function() {
            setTimeout(function() {
                if (backId != "" && (backId.lastIndexOf("@") > 0 && backId.lastIndexOf(".") > 0)) {
                    //这以下一行是去掉第一个不包含后的新增，如果要包含第一个用户自己输入的请注释 
                    if (backId.indexOf("@2980.com") < 0)
                        $("#" + eUserId + "").val(backId);
                }
                //这以下两行是去掉第一个不包含后的新增，如果要包含第一个用户自己输入的请注释 
                if ($("#" + eUserId + "").val().indexOf("@") < 0)
                    $("#" + eUserId + "").val($("#" + eUserId + "").val() + "@2980.com");
            }, 50);
            if ($(".l-error").length > 0) {
                $(".l-error").css("display", "none");
            }
            mynum = 0;
        });
    });
}

//公共部分
function ClewEmail(ClewEmail, txtEmail) {
    $("#" + ClewEmail + "").css("display", "");
    var allEmail = "2980.com,qq.com,126.com,163.com,gmail.com,yahoo.com,sina.com,hotmail.com,sohu.com,139.com,yeah.net,vip.qq.com".split(",");
    var myEmail = $("#" + txtEmail + "").val();
    var aEmail = "";
    var typeNum = 0;
    var t_email = "@2980";
    if (myEmail.indexOf("@") < 0)
        typeNum = 1; //输入中不包含@符号
    else {
//        for (var i = 0; i < allEmail.length; i++) {
//            var num1 = allEmail[i].indexOf(".");
//            t_email = "@" + allEmail[i].substring(0, num1);
//            if (myEmail.indexOf(t_email) > 0) {
//                typeNum = 2; //输入中包含@2980等的情况
//                break;
//            }
//        }
        if (typeNum != 2 && ((myEmail.indexOf(".com") > 0 || myEmail.indexOf(".cn") > 0 || myEmail.indexOf(".com.cn") > 0) && myEmail.indexOf("@") > 0)) {
            typeNum = 3; //输入中包含@，同时包含尾部的 .com  .cn  .com.cn等
        } else if (typeNum != 2 && (myEmail.indexOf("@") == myEmail.length - 1)) {
            typeNum = 5; //@符号后面没有任何
        } else if (typeNum != 2 && typeNum != 5 && ((myEmail.indexOf(".com") < 0 || myEmail.indexOf(".cn") < 0 || myEmail.indexOf(".com.cn") < 0) && myEmail.indexOf("@") > 0)) {
            typeNum = 4; //包含@但是不包含.com等
        }
    }
    if (typeNum == 1) {
        //aEmail += "<li href='javascript:void(0)' lihh=0 onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + myEmail + "</li>";
        for (var i = 0; i < allEmail.length; i++) {
            aEmail += "<li href='javascript:void(0)' lihh=" + (i + 1) + " onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + myEmail + "@" + allEmail[i] + "</li>";
        }
    } else if (typeNum == 2) {
        var topStr = myEmail.substring(0, myEmail.indexOf("@")).trim();
        var bodyStr = myEmail.substring(myEmail.indexOf(t_email));
        var bottomStr = "";
        if (bodyStr.indexOf(".") > 0)
            bottomStr = bodyStr.substring(bodyStr.indexOf("."));
        if (bodyStr.indexOf(".") > 0)
            bodyStr = bodyStr.substring(0, bodyStr.indexOf("."));
        aEmail += "<li href='javascript:void(0)' lihh=1 onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + topStr + bodyStr + bottomStr + "</li>";
        //aEmail += "<li href='javascript:void(0)' lihh=2 onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + topStr + bodyStr + ".com</li>";
    } else if (typeNum == 3) {
        var topStr = myEmail.substring(0, myEmail.indexOf("@")).trim();
        var tempStr = myEmail.substring(myEmail.indexOf("@"));
        var bodyStr = tempStr.substring(tempStr.indexOf("@"), tempStr.indexOf("."));
        var bottomStr = tempStr.substring(tempStr.indexOf("."));
        aEmail += "<li href='javascript:void(0)' lihh=1 onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + topStr + bodyStr + bottomStr + "</li>";
    } else if (typeNum == 4) {
        //aEmail += "<li href='javascript:void(0)' lihh=0 onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + myEmail + "</li>";
        for (var i = 0; i < allEmail.length; i++) {
            var temp = myEmail.substring(myEmail.indexOf("@") + 1);
            if (allEmail[i].indexOf(temp) == 0) {
                aEmail += "<li href='javascript:void(0)' lihh=" + (i + 1) + " onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + myEmail.substring(0, myEmail.indexOf('@')) + "@" + allEmail[i] + "</li>";
            }
        }
    } else if (typeNum == 5) {
        //aEmail += "<li href='javascript:void(0)' lihh=0 onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + myEmail + "</li>";
        for (var i = 0; i < allEmail.length; i++) {
            aEmail += "<li href='javascript:void(0)' lihh=" + i + " onmouseover=li_mouseover(this) onmouseout=li_mouseout(this) onclick=clickClewEmail(this,'" + ClewEmail + "','" + txtEmail + "')>" + myEmail + allEmail[i] + "</li>";
        }
    }
    $("#" + ClewEmail + "").html(aEmail);
}
function clickClewEmail(obj, ClewEmail, txtEmail) {
    $("#" + txtEmail + "").val($(obj).text());
    $("#" + ClewEmail + "").css("display", "none");
    var pass = $("#email_keyup").attr("tt");
    $("#" + pass + "").focus();
}

function li_mouseover(obj) {
    $(obj).css("background-color", "#E8F4FC");
}
function li_mouseout(obj) {
    $(obj).css("background-color", "#ffffff");
}


function clearSelectedOptBgColor(target) {
    if (target.seletedIndex >= 0)
        target.options[target.seletedIndex].style.backgroundColor = "";
}
function setSelectedOptBgColor(target) {
    if (target.seletedIndex >= 0&&target.options.length>0)
        target.options[target.seletedIndex].style.backgroundColor = "#E8F4FC";
}

var upKeyCode = 38;
var downKeyCode = 40;
var enterKeyCode = 13;
///-----------------------------------------------end---------------------------------------------------///


//-----------------------------------------------gs-------------------------------------//
//鼠标覆盖和移出延迟处理
//说明：使用jQuery的hover时，鼠标移到和移出对象时执行。某些情况下鼠标只是从对象上滑过，不希望执行hover中的方法，则调用此方法对时间延迟。
//只有鼠标确实移动到对象上方且停留时间大于等于延迟时间才会执行。
(function($) {
    $.fn.hoverdelay = function(options) {
        var defaults = {
            hoverDuring: 500,
            outDuring: 500,
            hoverEvent: function() {
                //$.noop();  //1.3.2版本不支持
            },
            outEvent: function() {
                //$.noop();
            }
        };
        var sets = $.extend(defaults, options || {});
        var hovertimer, outtimer;
        return $(this).each(function() {
            $(this).hover(function() {
                clearTimeout(outtimer);
                hovertimer = setTimeout(sets.hoverEvent, sets.hoverDuring);
            },
            function() {
                clearTimeout(hovertimer);
                outtimer = setTimeout(sets.outEvent, sets.outDuring);
            });
        });
    }
})(jQuery);

//光标移到末尾
function moveToEnd(obj) {
    obj = obj.get(0);
    obj.focus();
    var len = obj.value.length;
    if (document.selection) {
        var sel = obj.createTextRange();
        sel.moveStart('character', len);
        sel.collapse();
        sel.select();
    }
    else if (typeof obj.selectionStart == 'number' && typeof obj.selectionEnd == 'number') {
        obj.selectionStart = obj.selectionEnd = len;
    }
}
function getFaceImg(obj, targetid) {
    DyFace.area = $("#" + targetid);
    if (DyFace.area.val().replace(/\s/g, "") == "您最多填写50个字！")
        DyFace.area.val("");
    DyFace.show.apply(obj);
}
//-----------------------------------------------gs-----------------------------//



//--------------------------------------lyq 2011-10-31 提示小弹出层移至此处----------//
(function($){
	var 
	
	timer = 0,
	
	pop = function(title, type){
		if(!pop.$){
			var ie6 = window.ActiveXObject && !window.XMLHttpRequest;
			pop.$ = $("<div/>").html("\
			<div style='overflow:hidden;margin:0 5px;background:url(http://img.duoyi.com/025/img/tip.gif) repeat-x 0 -58px'>\
				<span id='body'></span>\
			</div>\
			<div style='overflow:hidden;position:absolute;top:0;left:0;width:5px;height:58px;background:url(http://img.duoyi.com/025/img/tip.gif) 0 0'></div>\
			<div style='overflow:hidden;position:absolute;top:0;right:0;width:5px;height:58px;background:url(http://img.duoyi.com/025/img/tip.gif) -22px 0'></div>\
			")
			.css(ie6 ?
				{position:"absolute",left:"50%", top : "45%",cursor:"pointer","z-index":10000} :
				{ position: "fixed", left: "50%", top: "50%", marginTop: -29, cursor: "pointer", "z-index": 10000 }
			)
			.click( close )
			.appendTo("body");
			
			pop.$body = $("#body",pop.$)
			.css({
				display 	:	"inline-block",
				background	:	"url(http://img.duoyi.com/025/img/tip.gif) no-repeat",
				margin 		: 	"15px 15px 16px 15px",
				paddingLeft : 	35,
				fontSize 	: 	12,
				color		:	"#333",
				lineHeight 	: 	"27px",
				fontWeight 	: 	"bold",
				height		:	27
			})
			.removeAttr("id");
			
			if(ie6){
				pop.$frame = $("<iframe />")
				.css({position:"absolute",top:0,left:0,height:58,"z-index":-1,opacity:0})
				.attr("frameborde",0)
				.appendTo(pop.$);
			};
		};
		
		pop.$body.text(title).css("backgroundPosition","0 " + (-116 - 27 * parseInt(type) || 0)  + "px");
		
		pop.$.css("margin-left", - pop.$.outerWidth() / 2 ).fadeIn("fast");
		
		if(ie6){
			pop.$.css("top" , document.documentElement.scrollTop + (document.documentElement.clientHeight - 58) / 2 );
			pop.$frame.width( pop.$.outerWidth());
		};
		clearTimeout( timer );
		timer = setTimeout( close, 1500);
	},
	
	close = function(){
		clearTimeout(timer);
		pop.$.fadeOut("fast");
	};
	
	window.showTip = function(msg){ pop(msg,0) };
	
	window.showAlert = function(msg){ pop(msg,1)};
	
	window.showError = function(msg){ pop(msg,2)}

})(window.jQuery);
//--------------------------------------lyq -------------------------------------------//

//-------------------------lcs 2011.12.12------------------------------------//
//退出登录
function client_quit(durl)
{
    $.post("/handlers/loginhandler.ashx?type=quit", "", function(data) {
        if (data == "1") {
             var
            //获取cookies名称
            cookies = document.cookie.match(/(^|;\s*)[^=]+/g),
            //保证cookie马上过时
            expires = new Date(0),
            //顶级域名
            domain = document.location.host.match(/^(?:\w+\.)+?(\w+\.[a-zA-Z]+)$/);
            
            for(var i in cookies){
                var cookie = cookies[i].replace(/^;\s+/,"");
                //删除当前域的cookie
                setCookie(cookie,"",expires);
                //删除顶级域cookie
                domain && setCookie(cookie,"",expires,domain[1]);
            }
            /*removeCookie("cookiename");
            removeCookie("cookiereader");
            
            removeCookie("buidQuery");*/
            
            document.location.replace( "/");
            
        }
    });
}
//-------------------------lcs------------------------------------//



//-------------------------lcs------------------------------------//
function URLencode(sStr){
    return escape(sStr).replace(/\+/g,'%2B').replace(/\"/g,'%22').replace(/\'/g,'%27').replace(/\//g,'%2F');
}


//-----------------------------gs------------------------------------//
//手机传情时间设置
var mbtimeset = {
    _begintime: 900,  //自定义时间的默认开始时间
    _endtime: 2230, //自定义时间的默认结束时间
    _busy: false, //标识位，防止重复提交
    _type: 0,  //提交类型
    _mbtimeset: "",  //设置的时间段
    _param: null,  //提交的数据
    $showmbtime: null,  //手机传情时间的显示
    $mbtimelist: null,  //手机传情时间的下拉菜单
    $mbtimechange: null,  //手机传情短信时间的修改链接
    $mbtimedefine: null,  //自定义时间的确定和取消
    $mbtimedefselect: null, //自定义时间的下拉菜单

    createselect: function(timesel, selid, flag) {  //创建自定义时间的下拉菜单
        var htmstr = "<select id='" + selid + "'>";
        for (var i = 0; i <= 24; i++) {
            var opval = i * 100;
            var isadd = flag ? (i < 24) : (i > 0);
            if (isadd)
                htmstr += "<option value='" + opval + "'" + ((opval == timesel) ? " selected" : "") + ">" + i + ":00</option>";
            if (i < 24) {
                opval += 30;
                htmstr += "<option value='" + opval + "'" + ((opval == timesel) ? " selected" : "") + ">" + i + ":30</option>";
            }
        }
        htmstr += "</select>";
        return htmstr;
    },
    afterdefine: function() {  //提交自定义时间后的操作
        mbtimeset.$mbtimelist.hide();
        mbtimeset.$showmbtime.show();
        mbtimeset.$mbtimedefine.hide();
        mbtimeset.$mbtimechange.show();
        if (mbtimeset.$mbtimedefselect != null)
            mbtimeset.$mbtimedefselect.hide();
        return false;
    },
    savembtimedefine: function() {  //保存自定义时间
        mbtimeset._begintime = parseInt($("#begtime").val());
        mbtimeset._endtime = parseInt($("#endtime").val());
        if (mbtimeset._begintime >= mbtimeset._endtime) {
            showError("结束时间至少要比开始时间晚30分钟");
            return false;
        }
        mbtimeset._mbtimeset = parseInt(mbtimeset._begintime / 100) + ":" + (((mbtimeset._begintime % 100) == 0) ? "00" : (mbtimeset._begintime % 100)) + "-" + parseInt(mbtimeset._endtime / 100) + ":" + (((mbtimeset._endtime % 100) == 0) ? "00" : (mbtimeset._endtime % 100));
        mbtimeset._param = $.param({ "mode": mbtimeset._type, "mbbegtime": mbtimeset._begintime, "mbendtime": mbtimeset._endtime });
        mbtimeset.postset();
        return false;
    },
    showdefine: function() {  //显示自定义时间的下拉菜单
        if ((mbtimeset.$mbtimedefselect == null) || (mbtimeset.$mbtimedefselect.html() == null)) {
            var htmstr = "<span id='mbtimelist'>" + mbtimeset.createselect(900, "begtime", true) + "-" + mbtimeset.createselect(2230, "endtime", false) + "</span>";
            mbtimeset.$showmbtime.after(htmstr);
            mbtimeset.$mbtimedefselect = $("#mbtimelist");
        }
        else
            mbtimeset.$mbtimedefselect.show();

        mbtimeset.$showmbtime.hide();
        mbtimeset.$mbtimedefine.show();
        mbtimeset.$mbtimechange.hide();
        mbtimeset.$mbtimedefine.find("a:last").click(mbtimeset.afterdefine);
        mbtimeset.$mbtimedefine.find("a:first").click(mbtimeset.savembtimedefine);
    },
    postset: function() {  //将选择的数据提交
        if (mbtimeset._busy) {
            showError("服务器正忙！请稍候再试！");
            return false;
        }
        if (mbtimeset.$showmbtime.html().replace(/\s/g, '') != mbtimeset._mbtimeset) {
            mbtimeset._busy = true;
            $.post("/handlers/mainhandler.ashx?type=chgflirt", mbtimeset._param, function(data) {
                mbtimeset._busy = false;
                if (data.toLowerCase().indexOf("error message") > -1) {
                    showError("设置过程中出现错误！");
                    return false;
                }
                var intdata = parseInt(data, 10);
                if ((intdata >= 0) && (intdata <= 4)) {
                    mbtimeset.$showmbtime.html(mbtimeset._mbtimeset);
                    if (mbtimeset._type == 4)
                        mbtimeset.afterdefine();
                    showTip("设置成功！");
                }
                else
                    showAlert("设置失败！");
            });
        }
        else {
            mbtimeset.afterdefine();
        }
    },
    selecttime: function() {   ////选择设置手机传情短信时间
        mbtimeset._type = parseInt($(this).attr("id").replace("chmobile", ""));
        if (mbtimeset._type != 4) {
            mbtimeset._mbtimeset = $(this).html().replace(/\s/g, '');
            mbtimeset._param = $.param({ "mode": mbtimeset._type });
            mbtimeset.postset();
        }
        else
            mbtimeset.showdefine();
    },
    show: function() {  //显示设置手机传情短信时间的下拉菜单
        mbtimeset.$showmbtime.addClass("a_mobile_on");
        mbtimeset.$mbtimelist.slideDown("fast");
        mbtimeset.$mbtimelist.find("a[id]").click(mbtimeset.selecttime);
        return false;
    },
    hide: function() {   //隐藏设置手机传情短信时间的下拉菜单
        mbtimeset.$mbtimelist.slideUp("fast", function() {
            mbtimeset.$showmbtime.removeClass("a_mobile_on");
        });
    },
    initparam: function(options) {  //初始化参数
        mbtimeset.$showmbtime = options.showpart;
        mbtimeset.$mbtimelist = options.mbtimeselect;
        mbtimeset.$mbtimechange = options.changebtn;
        mbtimeset.$mbtimedefine = options.defineobj;
        mbtimeset.$mbtimechange.click(mbtimeset.show);
        $("body").click(mbtimeset.hide);
    }
}

///////////////////////////////////////////////////帮人贴标签/////////////////////////////////////////////
var tagl = {
    _objtag: null, //帮人贴标签的链接
    _uid: 0, //对方的领爱id
    _count: 0, //获取推荐标签的数目
    _countlevel: 5, //超过此数量不能为对方贴标签
    _sellevel: 5, //贴标签时最多能选择的标签数量
    _sellabel: "",  //已选标签的字符串(例如：白领-91，白领-91<80后-65)
    isbusy: false,  //状态标志，防止重复提交
    $objclosebtn: null, //关闭弹出层的jQuery对象
    $objrecommlabels: null,  //每个推荐标签的jQuery对象
    $objsellabels: null, //已选标签部分的jQuery对象

    close: function() {  //关闭弹出层，变量重置
        tagl.$objclosebtn = null;
        tagl.$objrecommlabels = null;
        tagl.$objsellabels = null;
        tagl._sellabel = "";
        tagl.isbusy = false;
        $.modal.close();
    },
    postselact: function() {  //提交选择的标签
        if (tagl.isbusy) {
            showError("服务器正忙！请稍候提交！");
            return false;
        }
        if (tagl._sellabel == "") {
            showError("您还没有选择标签！");
            return false;
        }
        var sellarr = tagl._sellabel.split("<");
        if (sellarr.length > tagl._sellevel) {
            showError("您最多只能选择" + tagl._sellevel + "个标签！");
            return false;
        }
        var param = $.param({ "userid": tagl._uid, "sellabel": tagl._sellabel });
        tagl.isbusy = true;
        $.post("/Handlers/SeaHandler.ashx?type=taglabel", param, function(data) {
            tagl.isbusy = false;
            if (data.toLowerCase().indexOf("error message") > -1) {
                showError("贴标签失败！");
                return false;
            }
            data = eval(data);
            if (data.code == 0)
                showError(data.msg);
            else {
                tagl._objtag.attr("altag", "0");
                tagl.close();
                showTip(data.msg);
            }
            return false;
        });
    },
    delselact: function() {  //删除已选标签
        var lname = $(this).parent().text().replace("x", "");
        var lid = $(this).attr("id").replace("del_", "");
        var lstr = lname + "-" + lid;
        //将要删除的标签从已选标签的字符串中删除，同时在页面已选标签中删除，并将此标签的选择状态设置为：0，可以再次添加
        var fobj = $(".pop-01").find(".tagsGroup").find("a[hh='" + lid + "']:contains('" + lname + "')");
        fobj.attr("issel", "0");
        tagl._sellabel = tagl._sellabel.replace("<" + lstr + "<", "<").replace("<" + lstr, "").replace(lstr + "<", "").replace(lstr, "");
        $(this).parent().remove();
        return false;
    },
    addact: function() {  //添加标签
        if ($(this).attr("issel") == "1") {
            showError("您已经选择了此标签！");
            return false;
        }
        if (tagl.$objsellabels == null) {
            showError("添加过程中出现错误！");
            return false;
        }
        if (tagl.$objsellabels.find("span.Tags_1").size() >= tagl._sellevel) {
            showError("最多可选择" + tagl._sellevel + "个标签！");
            return false;
        }
        //将选择的标签添加到已选标签的字符串中，同时在页面已选标签中显示，并将此标签的选择状态设置为：1，防止重复选择
        if (tagl._sellabel != "")
            tagl._sellabel += "<";
        tagl._sellabel += ($(this).text() + "-" + $(this).attr("hh"));
        tagl.$objsellabels.append("<span class='Tags_1'>" + $(this).text() + "<a href='javascript:void(0)' class='tagClose' id='del_" + $(this).attr("hh") + "'>x</a></span>");
        $(this).attr("issel", "1");
        tagl.$objsellabels.find("span a").click(tagl.delselact);
    },
    queryLabels: function() {   //异步获取标签
        if (tagl.isbusy) {
            showError("服务器繁忙！请稍候重试！");
            return false;
        }
        var param = $.param({ "userid": tagl._uid, "count": tagl._count });
        tagl.isbusy = true;
        $.post("/Handlers/SeaHandler.ashx?type=getrecommlabel", param, function(data) {
            tagl.isbusy = false;
            if (data.toLowerCase().indexOf("error message") > -1) {
                showError("获取推荐标签错误");
                return false;
            }
            else if (data.length < 100) {
                data = eval(data);
                if (data.code == 0) {
                    if (data.msg == "0")
                        lwy.tipLogin();
                    else
                        showError(data.msg);
                }
            }
            else {
                $.modal(data);
                tagl.$objclosebtn = $(".pop-01").find("a.pop-01-close");
                tagl.$objrecommlabels = $(".pop-01").find(".tagsGroup a[hh]");
                tagl.$objsellabels = $(".pop-01").find("#sellabels");
                if (tagl.$objclosebtn != null)  //关闭弹出层
                    tagl.$objclosebtn.click(tagl.close);
                if (tagl.$objrecommlabels != null)
                    tagl.$objrecommlabels.click(tagl.addact);
                $(".pop-01").find(".btn-pop-02").click(tagl.postselact);
            }
        });
    },
    showRecommLabel: function(options) {   //外部调用显示弹出层 options:{ userid(对方的会员id):100132, count(获取推荐标签的数目): 20, alcount(对方已设标签的数目): 4, altag(是否为对方贴过标签1：没有贴过，0：已近贴过): 1 }
        tagl._objtag = options.obj;
        tagl._count = options.count;
        tagl._uid = parseInt(tagl._objtag.attr("uid"));
        if (tagl._uid == 0) {
            lwy.tipLogin();
            return false;
        }
        if (tagl._objtag.attr("altag") == "0") {
            showError("一星期内只能给同一个会员贴一次标签！");
            return false;
        }
        if (parseInt(tagl._objtag.attr("lcount")) > tagl._countlevel) {
            showError("对不起，该会员已经设置了" + tagl._countlevel + "个以上的标签！");
            return false;
        }
        tagl.queryLabels();
    }
}
//--------------------------end-gs----------------------------------//

//-----------2012.1.13 lcs------------//
function htmlEncode(html){
    return html.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
}
//-----------2012.1.13 lcs-----end-------//

/*-----------设置光标位置-----------*/
$.fn.extend({
    setCursorPosition :function(position){
        if(this.lengh == 0) return this;
        return $(this).setSelection(position, position);
    },
    
    setSelection : function(selectionStart, selectionEnd) {
        if(this.lengh == 0) return this;
        input = this[0];

        if (input.createTextRange) {
            var range = input.createTextRange();
            range.collapse(true);
            range.moveEnd('character', selectionEnd);
            range.moveStart('character', selectionStart);
            range.select();
        } else if (input.setSelectionRange) {
            input.focus();
            input.setSelectionRange(selectionStart, selectionEnd);
        }

        return this;
    },
    focusEnd : function(){
        this.setCursorPosition(this.val().length);
    }
    
});
/*-----------设置光标位置-----------*/

//表情预加载
window.DyFace || (function(){
    var 
    //等待对象
    clickObject,
    //焦点对象
    inputObject,
    //加载js中
    loading;
    window.DyFace = {
        show : function(){
            clickObject = this;
            inputObject = DyFace.area;
            
            //载入表情代码
            loading || $.getScript($.url("/js/face.js"),function(){
                if(clickObject && inputObject){
                    DyFace.area = inputObject;
                    DyFace.show.apply(clickObject);
                };
                
                //清空对象
                waitObject = null;
                inputObject = null;
            });
            
            loading = true;
        },
        close : function(){waitObject = null,inputObject = null}
    };
})();

//用于多个弹出框动画切换
var model = {
    first: 0,
    list: new Array(),
    CallbackMap: new Array(),
    add: function(obj, _Callback) {
        model.CallbackMap.push(_Callback);
        this.list.push(obj);
        if (this.first > 0) {
            $.modal.close();
        } else {
            this.show();
        }
    },
    show: function() {
        var t = this.list.shift();
        t.modal(this.op);
    },
    op: { onClose: function(dialog) {
        var oc = model.CallbackMap.shift();
        if (model.list.length == 0) {
            dialog.overlay.fadeOut(500, function() {
                if (typeof (oc) != "undefined" && oc != null && typeof (oc.onClose) != "undefined") {
                    oc.onClose($(this));
                }
                $.modal.close();
            });
            dialog.container.animate({ opacity: "hide", marginTop: "-=10" }, 200).animate({ marginTop: "+=10" }, 1, function() {
                model.first = 0;
            });
        } else {
            dialog.container.animate({ opacity: "hide", marginTop: "+=10" }, 200).animate({ marginTop: "-=10" }, 1, function() {
                if (typeof (oc) != "undefined" && oc != null && typeof (oc.onClose) != "undefined") {
                    oc.onClose($(this));
                }
                $.modal.close();
                model.show();
            });
        }
    }, onShow: function(dialog) {
        dialog.overlay.css("background-color", "black");
        dialog.container.hide().animate({ marginTop: "-=10" }, 1).animate({ opacity: "show", marginTop: "+=10" }, 200, function() {
            if (model.CallbackMap.length > 0) {
                var oc = model.CallbackMap[0];
                if (typeof (oc) != "undefined" && oc != null && typeof (oc.onShow) != "undefined") {
                    oc.onShow($(this));
                }
            }
        });
        if (model.first == 0) {
            dialog.overlay.hide().fadeIn(500);
            model.first++;
        }
    }
    }
};
/*……………挖掘……………*/
var DIG = {
    digx: null,
    url: baseurl.replace("public", "dodig"),
    options: null,
    digone: function(e, type, uid) {
        var rooturl = baseurl.substring(0, baseurl.indexOf("js/public"));
        if (DIG.digx == null) {
            $.getScript(this.url, function() {
                DIG.digx = new DIGX(rooturl)
                DIG.digx.digone(e, type, uid);
            });
        } else {
            DIG.digx.digone(e, type, uid);
        }
    }
};
$("[data-dodig]").live("click", function() {
    var p = $(this).attr("data-dodig").split("_");
    if (p.length == 2) DIG.digone($(this), p[0], parseInt(p[1]));
});
/*……………挖掘……………*/
/*……………通用动作……………*/
var Action = {
    actionx: null,
    url: baseurl.replace("public", "doaction"),
    options: null,
    doit: function(e, info) {
        var rooturl = baseurl.substring(0, baseurl.indexOf("js/public"));
        if (Action.actionx == null) {
            $.getScript(this.url, function() {
                Action.actionx = new ActionX(rooturl)
                Action.actionx.doit(e, info);
            });
        } else {
            Action.actionx.doit(e, info);
        }
    }
};
$("[data-doaction]").live("click", function() {
    var info = $(this).attr("data-doaction");
    Action.doit($(this), info);
});
/*……………通用动作……………*/

/*……………申请邀请码……………*/
var RegCode = {
    regcodex: null,
    url: baseurl.replace("public.v2", "DoRegister"),
    show: function(options) {
        var rooturl = baseurl.substring(0, baseurl.indexOf("js/public.v2"));
        if (RegCode.regcodex == null) {
            $.getScript(this.url, function() {
                RegCode.regcodex = new RegTer(rooturl);
                RegCode.regcodex.show(options);
            });
        } else {
            RegCode.regcodex.show(options);
        }
    }
};
/*……………申请邀请码……………*/

//增加的浮动提交建议与BUG
$(document).ready(function() {
    //bug提交弹出层
    var 
    $bugBox,
    //bug提交
    $bugDiv = $("#bug_top_box").click(function(source , other){
        //获取a元素的锚点
        var hash = (other || source.target).href;
        
        //如果不是a元素点击，返回
        if(!hash){ return }
        
        //滚动顶部
        if(/#top$/.test(hash)){
            //滚回顶
            scrollTo(0,0);
        }
        else if(/#bug(@[0-3])?$/.test(hash)){
            //如果弹出层存在则弹出
            if(!$bugBox){
                $bugBox = $("<div />").addClass("ui_popwin").css("display","none").html(
                "<div class=\"ui_popwin_box w455\">" +
                "<div class=\"ui_popwin_title fb f14px\">问题反馈<a href=\"#\" id=\"jyclose\" class=\"ui_pop_close fn_right\" title=\"关闭\">关闭</a></div>" +
                "<div class=\"ui_popwin_con\">" +
                "<div class=\"w430 m0a\">" +
                "<dl class=\"report_type\">" +
                "<dt class=\"fn_left\">问题类型：</dt>" +
                "<dd>" +
                "<input name=\"rtype\" type=\"radio\" value=\"1\" id=\"bug_radio_0\" /> <label for=\"bug_radio_0\">问题咨询</label> " +
                "<input name=\"rtype\" type=\"radio\" value=\"2\" id=\"bug_radio_1\"/> <label for=\"bug_radio_1\">建议或意见</label> " +
                "<input name=\"rtype\" type=\"radio\" value=\"3\" id=\"bug_radio_2\"/> <label for=\"bug_radio_2\">BUG/纠错</label>" +
                "<input name=\"rtype\" type=\"radio\" value=\"4\" id=\"bug_radio_3\"/> <label for=\"bug_radio_3\">资料修改</label>" +
                "</dd>" +
                "</dl>" +
                "<dl class=\"input_box\">" +
                "<dt >问题描述：</dt>" +
                "<dd class=\"inset_shadow\">  " +
                "<textarea id='jycontent' title=\"\"></textarea>" +
                "</dd>" +
                "</dl>" +
                "<div class=\"ui_popwin_btn_r\">" +
                "<input type=\"button\" value=\"提交反馈\" id='jysubmit' class=\"ui_button fn_left\" />" +
                "<span class=\"text fn_right\">客服热线：020-38029278</span>" +
                "</div>" +
                "</div>" +
                "</div>" +
                "</div>"
               );
               
               //关闭弹出层
               $("#jyclose" , $bugBox).click(function() {return $.modal.close() ,false}).removeAttr("id");
               
               //提交按钮
               $("#jysubmit" , $bugBox).click(function() {
                    var 
                    rtype = $(":radio[name=rtype]:checked").val(),
                    durl = window.location.href,
                    jycontent = $("#jycontent").val();
                    
                    if (jycontent == "") {
                        return showAlert("既然来了，您不想说点什么？");
                    };
                    
                    $.post("/Handlers/common.ashx",{action:"BugPost", rtype : rtype, durl : durl, jycontent : jycontent} , function(date){
                        showTip(date) , $.modal.close();
                    });
               })
               .removeAttr("id");
            }
            //选择默认的选项
            var checked = hash.match("[0-3]$");
            $("#bug_radio_" + (checked || 0), $bugBox).attr("checked","checked");
            $(document.body).append($bugBox);
            $bugBox.modal({ persist: true }) ;
        }
        return false;
    });
    
    //ie6
    if( $bugDiv.is("#bug_top_box") && window.ActiveXObject && !window.XMLHttpRequest){
        $(window).bind("scroll",function(){
            var scrollTop = 0;
            if (typeof window.pageYOffset != 'undefined') {
                scrollTop = window.pageYOffset;
            }
            else if (typeof document.compatMode != 'undefined') {
                scrollTop = document.documentElement.scrollTop;
            }
            else if (typeof document.body != 'undefined') {
                scrollTop = document.body.scrollTop;
            };
            
            $bugDiv.hide().css("top", scrollTop + 250).animate({opacity : "show"}, { duration: 300 });
        });
    };

    var localhash = document.location.hash;
    if (localhash == "#bug") {
        $("#bug_top_box .bug_show").trigger("click");
    }
});

function loadCss(cssUrl,loadedFunc){var regex=new RegExp(cssUrl,"i");$("link").each(function(){if(regex.test(this.href)){loadedFunc&&loadedFunc();cssUrl=null;return false;};});if(cssUrl){var link=document.createElement("link");link.rel="stylesheet";link.type="text/css";link.href=cssUrl;document.getElementsByTagName("head")[0].appendChild(link);loadedFunc&&(function(){if(link.attachEvent){link.attachEvent("onload",function(){setTimeout(loadedFunc,1)});}else{var delay=100;setTimeout(function(){if(loadedFunc.isCalled){return;};var loaded;if(/webkit/i.test(navigator.userAgent)){loaded=!!link.sheet;}else if(link.sheet){try{loaded==!!link.sheet.cssRules;}catch(ex){loaded=ex.code==18||ex.code==1000;}};delay--;setTimeout(loaded&&delay&&loadedFunc||arguments.callee,1);},0);}})();};};

//无头像用户提示
var HeadImgTip = {
    top : 0,
    left : 0,
    html : '<div class="missing_hp" style="top:200px;left:700px"><h3>亲，您还没有形象照</h3><p>所以不会出现在这里哦~</p><a class="gotopic" href="/pages/Registe/Upload_pic.aspx">立即上传</a><a href="javascript:void(0)" onclick="'+"$('.missing_hp').remove()"+'">我知道了</a></div>',
    setPoint : function(page){
        switch(page){
            case 1://我的领爱                           
                $(HeadImgTip.html).hide().appendTo($(".w_main")); 
                
                var p = parseInt(Math.random() * 4 + 1);
                switch(p){
                    case 1:
                        HeadImgTip.top = 300;
                        HeadImgTip.left = 240;
                        break;
                    case 2:
                        HeadImgTip.top = 10;
                        HeadImgTip.left = 150;
                        break;
                    case 3:
                        HeadImgTip.top = $("#fate").offset().top - 180;
                        HeadImgTip.left = 710;
                        break;
                    default:
                        HeadImgTip.top = 250;
                        HeadImgTip.left = 150;
                        break;
                }                
                break;
            case 2://观点活动会员
                $(HeadImgTip.html).hide().appendTo($(".content"));     
                HeadImgTip.top = 250;
                HeadImgTip.left = 700;
                break;
            case 3://搜索页
                $(HeadImgTip.html).hide().appendTo($(".w_main"));     
                HeadImgTip.top = 100;
                HeadImgTip.left = 100;
                break;
            case 4://挖QQ
                $(HeadImgTip.html).hide().appendTo($(".w_main"));     
                HeadImgTip.top = 200;
                HeadImgTip.left = 400;
                break;
            case 5://家务大作战
                $(HeadImgTip.html).hide().appendTo($(".w_main"));     
                HeadImgTip.top = 80;
                HeadImgTip.left = 100;
                break;
            case 6://爱猜猜
                $(HeadImgTip.html).hide().appendTo($(".w_main"));     
                HeadImgTip.top = 220;
                HeadImgTip.left = 100;
                break;
            case 7://缘分大比拼
                $(HeadImgTip.html).hide().appendTo($(".w_main"));     
                HeadImgTip.top = 90;
                HeadImgTip.left = 400;
                break;
        }
    },
    
    show : function(){
        
        var path = window.location.pathname.toLocaleLowerCase();
        
        var page = 0;
        
        if(path == "/me" || path.indexOf("personal.aspx") >= 0){
            page = 1;
        }
        if(path == "/life" || path.indexOf("lifelist.aspx") >= 0){
            page = 2;
        }
        if(path == "/sou" || path.indexOf("search.aspx") >= 0){
            page = 3;
        }
        if(path.indexOf("pages/digqq.aspx") >= 0){
            page = 4;
        }
        if(path.indexOf("fight/fight.aspx") >= 0){
            page = 5;
        } 
        if(path.indexOf("app/guess.aspx") >= 0){
            page = 6;
        }
        if(path.indexOf("app/fate.aspx") >= 0){
            page = 7;
        }
        
        if(page == 0) return;
        
        $.ajax({
            url : "/Handlers/common.ashx",
            data : {action:"noheadimg",page:page,t:new Date().getTime()},
            dataType : "json",
            success:function(json){               
                if(json.success){                   
                    HeadImgTip.setPoint(page);        
                    $(".missing_hp").css({top:HeadImgTip.top,left:HeadImgTip.left}).show();
                }
            }
        })             
        
        /*if($("#hidParams").length == 0) return;
        
        if($("#hidParams").attr("page") == undefined || $("#hidParams").attr("show") == undefined) return;
        
        var page = $("#hidParams").attr("page"),isShow = $("#hidParams").attr("show") == 1;
        
        if(!isShow) return;       
        
        HeadImgTip.setPoint(page);        
        $(".missing_hp").css({top:HeadImgTip.top,left:HeadImgTip.left}).show();*/
    }
};

//图片等比例绽放
function AutoResizeImage(maxWidth,maxHeight,objImg){
    var img = new Image();
    img.src = objImg.src;
    var hRatio;
    var wRatio;
    var Ratio = 1;
    var w = img.width;
    var h = img.height;
    wRatio = maxWidth / w;
    hRatio = maxHeight / h;
    if (maxWidth ==0 && maxHeight==0){
        Ratio = 1;
    }else if (maxWidth==0){//
        if (hRatio<1) Ratio = hRatio;
    }else if (maxHeight==0){
        if (wRatio<1)  Ratio = wRatio;
    }else if (wRatio<1 || hRatio<1){
        Ratio = (wRatio<=hRatio?wRatio:hRatio);
    }
    if (Ratio<1){
         w = w * Ratio;
         h = h * Ratio;
    }
    objImg.height = h;
    objImg.width = w;
}

//获取其它网站文章列表（ladybate，热词）
$.fn.extend({
    //焦点图，ulImgList:对应图片列表的ID，ulNumList：对应切换编号列表的ID    
    focusImage: function(){
        var method = {
            imgList: "",
            numList: "",
            currIndex: 0,//当前位置
            play: function(index){
                if(index == method.currIndex) return;
                method.imgList.find("li").eq(method.currIndex).fadeOut(500);
                method.numList.find("li").eq(method.currIndex).removeClass("current");        
                method.imgList.find("li").eq(index).fadeIn(500);
                method.numList.find("li").eq(index).addClass("current");
                method.currIndex = index;
            },
            init: function(){
                method.imgList.find("li:eq(0)").show();
                method.numList.find("li").hover(function(){                    
                    var index = method.numList.find("li").index($(this));
                    method.play(index);
                    
                });
            }
        }
        method.imgList = $(this);
        method.numList = $(this).next("ul");       
        method.init();
    },
    addLadybate: function(width) {
        var url = "http://www.ladybeta.com/api?act=recommend";
        var ladyDiv = $(this);
        $.getScript(url, function () {
             eval("var json=" + ladybetaRSS);                
             if(json == undefined || json.data.length == 0 || json.data.length < 4) return;             
             if(!ladyDiv.hasClass("divLadybate")) ladyDiv.addClass("divLadybate");
             var html = '<div class="lady_innerDiv" >';
             
             //焦点图
             html += '<div class="photo_pen"><ul id="ulLadyList" class="photo_pen_list">';
             for(var i=0;i<4;i++){
                html += '<li style="display:none"><img width="236" src="'+json.data[i].CoverPic+'" alt="'+json.data[i].Title+'" /><a href="'+json.data[i].Url+'" target="_blank">'+json.data[i].Title+'</a></li>';
             }
             html += '</ul><ul class="photo_pen_no"><li class="current">第1页</li><li>第2页</li><li>第3页</li><li>第4页</li></ul></div>';  
             
             //文章列表
             html += '<ul class="only_pen">';  
             for(var i=4;i<json.data.length;i++){
                html += '<li><a href="'+json.data[i].Url+'" target="_blank">'+json.data[i].Title+'</a></li>';
             }
             html += '</ul>';
             
             //结束
             html += '</div>';
             
             ladyDiv.html(html);
             
             $("#ulLadyList").focusImage();
        })
    },
    addHotwords:function(){
        var url = "http://hot.22580.com/admin/hotkeypush";
        var hotDiv = $(this);
        setTimeout(function(){
            $.getScript(url, function () {
                 eval("var json=" + hotkeyRSS);                
                 if(json == undefined || json.data.length == 0 || json.data.length < 4) return;                 
                 if(!hotDiv.hasClass("divLadybate")) hotDiv.addClass("divLadybate");
                 var html = '<div class="lady_innerDiv" >';
                 
                 //焦点图
                 html += '<div class="photo_pen"><ul id="ulHotList" class="photo_pen_list">';
                 for(var i=0;i<4;i++){
                    html += '<li style="display:none"><img onload="AutoResizeImage(236,0,this)" src="'+json.data[i].coverpic+'" alt="'+json.data[i].title+'" /><a href="'+json.data[i].url+'" target="_blank">'+json.data[i].title+'</a></li>';
                 }
                 html += '</ul><ul class="photo_pen_no"><li class="current">第1页</li><li>第2页</li><li>第3页</li><li>第4页</li></ul></div>';  
                 
                 //文章列表
                 html += '<ul class="only_pen">';  
                 for(var i=4;i<json.data.length;i++){
                    html += '<li><a href="'+json.data[i].url+'" target="_blank">'+json.data[i].title+'</a></li>';
                 }
                 html += '</ul><span class="robe"></span>';
                 
                 //结束
                 html += '</div>';
                 
                 hotDiv.append(html);
                 $("#ulHotList").focusImage();
            })
        },1000);
    }
});

$(document).ready(function(){
    setTimeout(function(){ HeadImgTip.show();},1000);
})